<!-- 管理员培养方案管理 -->
<template>
  <div class="assessment-container" style="width: 100%;">
    <div class="search-container" style="margin:0;padding-left:0">
      <div class="search-container-left" style="display: flex">
        <div class="search-container-item">
          <span style="color:#004ca7">版本：</span>
          <el-select
            v-model="bb"
            style="width: 90px"
            size="mini"
            placeholder="请选择"
            clearable
          >
            <el-option
              v-for="item in xqList"
              :key="item.bb"
              :label="item.bb"
              :value="item.bb"
            >
            </el-option>
          </el-select>
        </div>
        <div class="search-container-item" style="margin-left:15px">
          <span style="color:#004ca7">培养层次：</span>
          <el-select
            v-model="pyfafl"
            style="width: 100px"
            size="mini"
            placeholder="请选择"
            clearable
          >
            <el-option
              v-for="(item,index) in pyccList"
              :key="index"
              :label="item.dictValue"
              :value="item.dictKey"
            >
            </el-option>
          </el-select>
        </div>
        <div class="search-button" @click="chax" style="margin: 3px 15px 0 15px;">
          <img src="@/assets/assessment/icon-search.png" alt="" />
          <span>查询</span>
        </div>
        <!-- <el-button type="danger" @click="batchRemove()" icon="el-icon-delete" size="mini" :disabled="dataListSelections.length <= 0">批量删除选中删除</el-button> -->
        <!-- <el-button type="warning" icon="el-icon-circle-plus-outline" @click="cjrc" size="mini">创建人才培养方案</el-button> -->
        <div
          class="plsc-button"
          @click="batchRemove()"
          style="width: 180px; margin: 3px 15px 0 0;"
        >
          <img src="@/assets/assessment/删除.png" alt="" />
          <span>批量删除选中删除</span>
        </div>
        <div
          class="cjrc-button"
          @click="cjrc"
          style="width: 180px; margin: 3px 15px 0 0;font-size:16px;line-height: 28px;"
        > 
          <img src="@/assets/assessment/组 738.png" alt="" />
          <span>创建人才培养方案</span>
        </div>
      </div>
    </div>
    <div class="table-container">
      <el-table
        :data="tableData"
        style="width: 100%"
        :current-row-key="currentKey"
        class="xpaas-table-class"
        row-class-name="xpaas-row-class"
        cell-class-name="xpaas-cell-class"
        header-row-class-name="xpaas-header-row-class"
        header-cell-class-name="xpaas-header-cell-class"
        @selection-change="handleSelectionChange"
      >
      <!-- class="table-data"
        row-class-name="row-class"
        cell-class-name="cell-class"
        header-row-class-name="header-row-class"
        header-cell-class-name="header-cell-class" -->
        <el-table-column width="70" align="center" type="selection">
        </el-table-column>
        <el-table-column
          prop="cz"
          label="操作"
          width="450"
          align="center"
          class-name=""
          label-class-name=""
        >
          <template slot-scope="scope">
            <!-- <el-button type="success" icon="el-icon-edit" @click="edit(scope.row)" size="mini">修改</el-button>
            <el-button type="warning" icon="el-icon-setting" @click="kcsz(scope.row)" size="mini">课程设置</el-button>
            <el-button type="danger" icon="el-icon-delete" @click="sc(scope.row.id)" size="mini">删 除</el-button>
            <el-button type="primary" icon="el-icon-document" @click="detail(scope.row)" size="mini">详 情</el-button> -->
            <div class="lucj-import-button" @click="edit(scope.row)" style="border:1px solid #02c86c;color: #02c86c;background: #f1fff8;">
              <img src="@/assets/assessment/icon-plan-record-detail.png" alt="" />
              <span style="margin: 0 0 0 5px;">修改</span>
            </div>
            <div class="lucj-import-button" @click="kcsz(scope.row)" style="border:1px solid #f86900;color: #f86900;background: #fff6ef;">
              <img src="@/assets/assessment/设置.png" alt="" style="width:16px;height:16px" />
              <span style="margin: 0 0 0 5px;">课程设置</span>
            </div>
            <div class="lucj-import-button" @click="sc(scope.row.id)" style="border:1px solid #ff3819;color: #ff3819;background: #ffefef;">
              <img src="@/assets/assessment/删除.png" alt="" />
              <span style="margin: 0 0 0 5px;">删除</span>
            </div>
            <div class="lucj-import-button" @click="detail(scope.row)" style="border:1px solid #51aef6;color: #51aef6;background: #f1f8fe;">
              <img src="@/assets/assessment/icon-look.png" alt="" style="width:17px" />
              <span style="margin: 0 0 0 5px;">详情</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column
          prop="mc"
          label="人才培养方案名称"
          align="center"
        >
        </el-table-column>
        <el-table-column prop="bb" label="版本" align="center">
        </el-table-column>
        <el-table-column prop="zybh" label="专业编号" align="center">
        </el-table-column>
        <el-table-column prop="syzy" label="专业名称" align="center">
        </el-table-column>
        <el-table-column prop="pyLevel" label="培养层次" align="center">
        </el-table-column>
        <el-table-column prop="edzxf" label="额定总学分" align="center">
        </el-table-column>
      </el-table>
    </div>
    <div class="bottom-block" style="margin-left: 2.5%; cursor: pointer">
      <!-- <div class="export-button" @click="exportFile">
        <img src="../../../assets/assessment/icon-export.png" alt="" />
        <span>导出Excel</span>
      </div> -->
    </div>
    <div class="block" style="margin-bottom: 50px;">
      <el-pagination
        style="width:auto;float:right;margin-bottom:50px;padding:0"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="pageNo"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import { getConditionList, remove,reqRemoveTraining,querybb } from "@/api/propositionReview/approval";
import { reqCheckLevelList } from "@/api/admin1/check";
export default {
  data() {
    return {
      pageNo: 1,
      pageSize: 10,
      total: "",
      currentKey:0,
      dataListSelections:[],
      ids:'',
      xq: "",
      id: "",
      index: "",
      bb: "",
      courselistsList: "",
      pyfafl: "",
      value: "",
      xqList: [],
      pycc: "",
      pyccList: [],
      tableData: [],
    };
  },
  created() {
    this.querybb();
    this.reqCheckLevelList();
    this.getConditionList();
  },
  methods: {
    //获取培养层次下拉框
    reqCheckLevelList(){
      let that = this;
      reqCheckLevelList().then(res => {
        if(res.data.code == 200 && res.data.data){
          that.pyccList = res.data.data[0].children;
          // that.traininglevel = res.data.data[0].children[0].dictValue;
        }
      });
    },
    //获取版本下拉框
    querybb(){
      let that = this;
      querybb().then(res => {
        if(res.data.code == 200 && res.data.data){
          that.xqList = res.data.data;
        }
      });
    },
    //获取表格数据
    getConditionList() {
      return new Promise(() => {
        getConditionList(this.pageNo, this.pageSize, this.bb, this.pyfafl).then(
          (res) => {
            this.tableData = res.data.data;
            this.total = res.data.data.length > 0 ? res.data.data[0].tol : '';
            for (let i = 0; i < this.tableData.length; i++) {
              this.id = this.tableData[i].id;
            }
          }
        );
      });
    },
    //删除单条数据
    sc(id) {
      this.$confirm('确认要删除吗？')
        .then(_ => {
          remove(id).then((res) => {
            if(res.data.code == 200 && JSON.stringify(res.data.data) === '{}'){
              this.$message({
                showClose: true,
                message: '删除成功！',
                type: "success",
              });
              this.pageNo = this.tableData.length > 1 ? this.pageNo : this.pageNo - 1;
              this.getConditionList();
            } else {
              this.$message({ type: "error", message: res.data.data, duration:5000 });
              this.getConditionList();
            }
          })
        })
    },
    //批量删除数据
    batchRemove(){
      if(this.dataListSelections.length <= 0){
        this.$message({ type: "error", message: '请先选择需要删除的数据！' });
      } else {
        this.$confirm('确认要删除吗？')
          .then(_ => {
            reqRemoveTraining(this.ids).then(res =>{
              if (res.data.code == 200  && JSON.stringify(res.data.data) === '{}') {
                this.$message({ type: "success", message: '删除成功！' });
                this.getConditionList();
              } else {
                this.$message({ type: "error", message: res.data.data, duration:5000 });
                this.getConditionList();
              }
            })
          })
      }
    },
    //  handleSelectionChange(val) {
    //    console.log(val,898989)
    //    this.list=val
    //    for(let i=0;i<=this.list.length;i++){
    //      this.tablelist.courselistsDto[i].matchid=val[i].id
    //       arr.push(val[i].id)
    //    }
    //     this.handleSelection.splice(0, this.handleSelection.length);
    //    console.log(this.idt,567)
    //   },

    //表格操作
    handleSelectionChange(val) {
      let newArr = [],that = this;
      that.dataListSelections = val;
      val.forEach((element) => {
        newArr.push(element.id);
      });
      that.ids = newArr.join(",");
    },
    handleCurrentChange(val) {
      this.pageNo = val;
      this.getConditionList();
    },
    handleSizeChange(val) {
      this.pageSize = val;
      this.getConditionList();
    },
    chax() {
      this.pageNo = 1;
      return new Promise(() => {
        getConditionList(this.pageNo, this.pageSize, this.bb, this.pyfafl).then(
          (res) => {
            this.tableData = res.data.data;
            this.total = res.data.data[0].tol;
            for (let i = 0; i < this.tableData.length; i++) {
              this.id = this.tableData[i].id;
            }
          }
        );
      });
    },
    //导出文件
    exportFile(){

    },
    cjrc() {
      this.$router.push({
        path: "/admin/training/talent", //要跳转的页面的路由
      });
    },
    edit(row) {
      let data = row;
      this.$router.push({
        path: "/admin/training/modify",
      });
      localStorage.setItem('setDetails',JSON.stringify(data));
    },
    detail(row) {
      this.$router.push({
        path: "/admin/training/programmanagement",
      });
      localStorage.setItem('setDetails',JSON.stringify(row));
    },
    kcsz(row) {
      this.$router.push({
        path: "/admin/training/setCourseType", //要跳转的页面的路由
      });
      localStorage.setItem('setCourse',JSON.stringify(row));
    },
    sxq(id) {
      this.$router.push({
        path: "/admin/training/details", //要跳转的页面的路由
        query: {
          id: id,
        },
      });
    },
    downLoadExcel() {
      let el = this;
      let planid = this.tableData[this.reportIndex].planid;
      let href =
        window._CONFIG.previewurl +
        `/scorequery/downLoadExcel?planid=${planid}`;
      let alink = document.createElement("a");
      el.$message({
        showClose: true,
        message: "下载中，请稍后",
        type: "success",
      });
      alink.style.display = "none";
      alink.download = "按课程导出.word"; //下载后文件名
      alink.href = href;
      document.body.appendChild(alink);
      alink.click();
      document.body.removeChild(alink); //下载完成移除元素
    },
    lucjClick(index) {
      this.showInportReportDialog = true;
      this.reportIndex = index;
    },
  },
  mounted() {
  },
};
</script>
<style lang="less" scoped>
// @import "../../../styles/print-entry.less";
/deep/.assessment-container {
  margin: 0;

  .el-table td,
  .el-table th.is-leaf,
  .el-table--border,
  .el-table--group {
    border-color: #c7d7eb;
  }

  /deep/.el-table__header tr,
  /deep/.el-table__header th {
    padding: 0;
    height: 76px;
    background-color: #edf2f9;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    line-height: 20px;
    color: #004ca7;
  }

  .el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 86px;
  }

  .el-checkbox__inner:hover {
    border-color: #004ca7;
  }

  .el-checkbox__inner {
    border: 1px solid #004ca7;
    border-radius: 0;
  }

  .el-checkbox__input.is-checked .el-checkbox__inner,
  .el-checkbox__input.is-indeterminate .el-checkbox__inner {
    background-color: #004ca7;
    border-color: #004ca7;
  }

  .el-checkbox__input.is-checked + .el-checkbox__label {
    color: #004ca7;
  }

  .el-checkbox.is-bordered.is-checked {
    border-color: #004ca7;
  }

  .el-checkbox__input.is-focus .el-checkbox__inner {
    border-color: #004ca7;
  }
}
.lucj-import-button{
  width: 85px;
  height: 28px;
  background: #efebff;
  border: 1px solid #5230e9;
  border-radius: 6px;
  color: #5230e9;
  display: inline-block;
  /* align-items: center;
  justify-content: center; */
  cursor: pointer;
  margin-left: 15px;
  line-height: 28px;
  img {
    width: 14px;
    height: 14px;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    position: relative;
    top: 2px;
  }
}
.manual-entry-container {
  .el-dialog__body {
    > div {
      width: 1014px;
      border: 1px solid rgba(0, 76, 167, 0.8);
      border-radius: 6px;
      margin: 0 auto;

      > div {
        border-bottom: 1px solid rgba(0, 76, 167, 0.39);

        &:last-child {
          border-bottom: none;
        }

        > div {
          display: flex;

          > div {
            height: 96px;
            display: flex;
            align-items: center;
            justify-content: center;

            &:nth-child(1) {
              width: 80%;

              text-align: center;
              font-size: 16px;
              font-weight: bold;
              color: #004ca7;
            }

            &:nth-child(1) {
              height: 200px;
            }
          }
        }
      }
    }
  }
  /deep/ .el-button--primary.is-plain{
    font-size: 16px;
    height: 28px;
  }

  .el-dialog__footer {
    padding-bottom: 43px;
  }

  /* .dialog-footer {
    > button {
      width: 95px;
      height: 36px;
      background: #fff6ef;
      border: 1px solid #f3b815;
      border-radius: 6px;
      background: rgba(255, 246, 239, 1);
      font-size: 18px;
      color: #f3b815;
    }
  } */
}

.assessment-container {
  width: 100% !important;
  .export-report-container {
    .el-dialog__body {
      padding: 64px 0 64px 50px;
      .el-radio {
        margin-right: 79px;
      }
    }
    .el-dialog__footer {
      padding-bottom: 103px;
    }
  }
  .import-report-container {
    .el-dialog__body {
      padding-left: 165px;
      padding-top: 71px;
      padding-bottom: 60px;

      > div {
        > span {
          font-size: 18px;
          font-weight: bold;
          line-height: 20px;
          color: #004ca7;
          vertical-align: middle;
        }

        > input {
          width: 254px;
          height: 25px;
          border: 1px solid #004ca7;
          opacity: 1;
          border-radius: 4px;
          padding-left: 5px;
          margin-right: 8px;
          color: #004ca7;
          vertical-align: middle;
        }

        > div {
          display: inline-block;
          font-size: 18px;
          padding: 1px 10px;
          border-radius: 4px;
          vertical-align: middle;
          cursor: pointer;

          &:nth-child(3) {
            color: rgba(2, 200, 108, 1);
            background: #f1fff8;
            border: 1px solid #02c86c;
            position: relative;
            margin-right: 20px;

            > input {
              width: 822px;
              position: absolute;
              left: -767px;

              cursor: pointer;
            }
          }

          &:nth-child(4) {
            color: rgba(82, 48, 233, 1);
            background: rgba(235, 230, 255, 1);
            border: 1px solid rgba(82, 48, 233, 1);
          }
        }
      }
    }

    .el-dialog__footer {
      padding-bottom: 76px;

      .green {
        padding: 1px 17px;
      }
    }
  }
}
@fontFamily:"Microsoft YaHei";
.xpaas-table-class {
  border: 1px solid #004ca7;
  border-radius: 9px;
  margin: 15px 0;
  > ::v-deep div.el-table__header-wrapper {
    > table.el-table__header {
      > thead {
        > tr.xpaas-header-row-class {
          padding: 0;
          height: 76px;
          background-color: #edf2f9;
          font-size: 16px;
          font-family: Microsoft YaHei;
          font-weight: bold;
          line-height: 20px;
          color: #004ca7;
          > th.xpaas-header-cell-class {
            font-weight: bold;
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
  > ::v-deep div.el-table__body-wrapper {
    > table.el-table__body {
      > tbody {
        > tr.xpaas-row-class {
          > td.xpaas-header-cell-class {
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
          > td.xpaas-cell-class {
            height: 76px;
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            > div.cell {
              font-weight: normal;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
}

/* .table-container {
  margin: 15px auto;
  .table-data {
    width: 100%;
    border: 0.8px solid #004ca7;
    border-radius: 9px;
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #004ca7;
  }
} */
.plsc-button {
  height: 28px;
  background: #ffefef;
  border: 1px solid #fa5339;
  border-radius: 6px;
  color: #ff3819;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  img {
    width: 14px;
    height: 14px;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    margin: 2px 5px 0 0;
  }
}
.cjrc-button {
  height: 28px;
  background: #efebff;
  border: 1px solid #5230e9;
  border-radius: 6px;
  color: #5230e9;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  img {
    width: 14px;
    height: 14px;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    margin: 2px 5px 0 0;
  }
}
.search-button {
  width: 77px;
  height: 28px;
  line-height: 28px;
  background: #f1f8fe;
  border: 1px solid #51aef6;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  > span {
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #51aef6;
  }
  > img {
    width: 20px;
    height: 20px;
    margin-right: 4px;
  }
}
</style>

